import mongoose from '../dbHelper';
import { defaultSchemaExtend, defaultSchemaOptions } from "../config/index";

const Schema = mongoose.Schema;

const QianchuanBuyCodeSchema = new Schema(Object.assign({
    goods: {
        type: Schema.Types.ObjectId,
        ref: 'DlyadminAigoods' // 商品的ID
    },
    proxy: {
        type: Schema.Types.ObjectId,
        ref: 'DlyAdminUser' // 代理的ID
    },
    useStatus: {
        type: Number,
        default: 0 // 0 未使用 1 已使用 使用状态
    },
    useTime: {
        type: Date, // 兑换时间
    },
    useShop: {
        type: Schema.Types.ObjectId,
        ref: 'Shop' // 兑换的店铺ID
    },
    useAdId: {
        type: String // 兑换的广告ID
    }
}, defaultSchemaExtend), defaultSchemaOptions);

const QianchuanBuyCode = mongoose.model('QianchuanBuyCode', QianchuanBuyCodeSchema, 'QianchuanBuyCodes');

export default QianchuanBuyCode